package edu.gdkm.iodemo;

import java.io.*;

public class ScoreDemo {
    public static void main(String[] args) throws IOException {
        File file = new File(".\\doc\\score.txt");
        BufferedReader br = new BufferedReader(new FileReader(file));
        int count = 0;//班级人数
        String maxName="", minName="";
        double maxScore = 0, minScore = 100;
        String s;
        while ((s = br.readLine()) != null) {
            count++;
            String[] scores = s.split(",");
            String name = scores[0];
            String sno = scores[1];
            double score1 = Double.parseDouble(scores[2]);
            double score2 = Double.parseDouble(scores[3]);
            double score3 = Double.parseDouble(scores[4]);
            double score4 = Double.parseDouble(scores[5]);
            double score = score1 + score2 + score3 + score4;
//               System.out.println(name+"的总成绩是："+(score));
            if(score>maxScore){
                maxName=name;
                maxScore=score;
            }
            if(score<minScore){
                minName=name;
                minScore=score;
            }
        }
        //统计这个班的总人数，最高、最低分得主和分值
        System.out.println("这个班的总人数是：" + count);
        System.out.println("最高分是"+maxName+"的"+maxScore);
//        System.out.println("最低分是"+minName+"的"+minScore);
    }
}
